/**
 * Created by qianj on 2017/9/7 0007.
 */
function WebSocketTest() {
//        var url = "ws://"+window.location.host+"/ws";
       var url = "wss://www.deeokay.top:8081";
//     var url = "ws://127.0.0.1:8081";
    socket = new WebSocket(url);
    console.log("连接状态:",socket.readyState);
    socket.onopen = function(e){
        console.log("onopen",e);
        console.log("连接状态:",socket.readyState);
    };
    socket.onmessage = function(e){
        console.log("连接状态:",socket.readyState);
        console.log("收到信息,",e);
        var message = document.getElementById("message");
        message.innerText=e.data;

    };
    socket.onclose = function(e){
        console.log("onclose");
        console.log("连接状态:",socket.readyState,e);

    };
    socket.onerror = function(e){
        console.log("onerror",e);
        console.log("连接状态:",socket.readyState);
    };
}
var socket = null;


window.onload = function () {
    var b_create = document.getElementById("b_create")
    b_create.onclick = function () {
        alert("cao.")
    }

};
